<div class="CommonHeader">
    <div class="CommonBackBtn"><a href="javascript:history.go(-1)"><img src="__CDN__/map/images/return_black.png" alt="返回"/></a></div>
    <div class="CommonTitle">投诉建议</div>
</div>

<div class="CommonMain">
    <form action="" method="post">
        <div class="ComplainTextareaBox">
            <div class="ComplainTextarea">
                <textarea class="textarea" maxlength="200" name="content" placeholder="您输入您要反馈的内容"></textarea>
                <div class="numBox"><span id="num">0</span> / 200</div>
            </div>

        </div>
        <div class="ComplainBox Mt20">
            <div class="ComplainDiv am-cf">
                <span class="am-fl">联系电话</span>
                <input class="am-fr" type="text" name="phone"  placeholder="选填，以便于我们联系你"/>
            </div>
        </div>

        <div class="DmBtn Mt70">
            <input disabled class="GrayBg gradualBg" type="button" value="提交"/>
        </div>
    </form>
</div>
<style>
    .GrayBg{background: #e1e1e1!important;}
</style>
<script type="text/javascript" src="__CDN__/assets/js/jquery.form.js"></script>

<script>
    $(document).on('keydown','.textarea',function(){
        let that = $(this)
        let valLength = that.val().length
        $('#num').text(valLength)
    })

    $(document).on('input','.textarea',function(){
        
        if($(this).val()){
            $('.gradualBg').removeClass('GrayBg').attr("disabled",false);
        }else{
            $('.gradualBg').addClass('GrayBg').attr("disabled",true);
        }
    })

    $('.gradualBg').on('click',function () {

        $("form").ajaxSubmit(function (e) {
            if(e.code==1){
                alert('保存成功')
                history.go(-1);
            }else{
                alert(e.msg);
            }

        })
    })
</script>
